package com.cb.controller;

import com.cb.service.AdministratorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

@RestController
@RequestMapping("/administrator")
@Api(value = "管理员本身操作", description = "管理员本身操作")
public class AdministratorController {

    @Autowired
     AdministratorService administratorService;

    /**
     * 登录
     * @param json
     * @param request
     * @return
     */
    @PostMapping("/login")
    @ResponseBody
    @ApiOperation(value = "登录", notes = "登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "username", value = "帐号"),
            @ApiImplicitParam(name = "password", value = "密码"),
    })
    public String administratorLogin(@RequestBody HashMap json, HttpServletRequest request){
        return administratorService.administratorLogin(json,request);
    }

    @PostMapping("/xianshi")
    @ResponseBody
    public String xianshi(HttpServletRequest request){
        return administratorService.xianshi(request);
    }
}
